package com.xydtech.rule.service.impl;

import java.util.List;

import com.xydtech.common.annotation.DataScope;
import com.xydtech.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xydtech.rule.mapper.RuleElementsGroupMapper;
import com.xydtech.rule.domain.RuleElementsGroup;
import com.xydtech.rule.service.IRuleElementsGroupService;
import com.xydtech.common.core.text.Convert;

/**
 * 规则要素组Service业务层处理
 * 
 * @author xydtech
 * @date 2024-06-06
 */
@Service
public class RuleElementsGroupServiceImpl implements IRuleElementsGroupService 
{
    @Autowired
    private RuleElementsGroupMapper ruleElementsGroupMapper;

    /**
     * 查询规则要素组
     * 
     * @param id 规则要素组主键
     * @return 规则要素组
     */
    @Override
    public RuleElementsGroup selectRuleElementsGroupById(Long id)
    {
        return ruleElementsGroupMapper.selectRuleElementsGroupById(id);
    }

    /**
     * 查询规则要素组列表
     * 
     * @param ruleElementsGroup 规则要素组
     * @return 规则要素组
     */
    @Override
    @DataScope(deptAlias = "d")
    public List<RuleElementsGroup> selectRuleElementsGroupList(RuleElementsGroup ruleElementsGroup)
    {
        return ruleElementsGroupMapper.selectRuleElementsGroupList(ruleElementsGroup);
    }

    /**
     * 新增规则要素组
     * 
     * @param ruleElementsGroup 规则要素组
     * @return 结果
     */
    @Override
    public int insertRuleElementsGroup(RuleElementsGroup ruleElementsGroup)
    {
        ruleElementsGroup.setSts("1");
        ruleElementsGroup.setCreateTime(DateUtils.getNowDate());
        return ruleElementsGroupMapper.insertRuleElementsGroup(ruleElementsGroup);
    }

    /**
     * 修改规则要素组
     * 
     * @param ruleElementsGroup 规则要素组
     * @return 结果
     */
    @Override
    public int updateRuleElementsGroup(RuleElementsGroup ruleElementsGroup)
    {
        return ruleElementsGroupMapper.updateRuleElementsGroup(ruleElementsGroup);
    }

    /**
     * 批量删除规则要素组
     * 
     * @param ids 需要删除的规则要素组主键
     * @return 结果
     */
    @Override
    public int deleteRuleElementsGroupByIds(String ids)
    {
        return ruleElementsGroupMapper.deleteRuleElementsGroupByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除规则要素组信息
     * 
     * @param id 规则要素组主键
     * @return 结果
     */
    @Override
    public int deleteRuleElementsGroupById(Long id)
    {
        return ruleElementsGroupMapper.deleteRuleElementsGroupById(id);
    }
}
